<template>
	<view class="">
		<view class="m-2 mb-3 bg-white rounded-20">
			<view class="pb-2">
				<view class="boards_title mx-2 pt-4 mt-2 font-md j-sb d-flex">
					<view class="font-weight font-33 ml-2 changyong">常用应用</view>
					
<!-- 					 <navigator target="miniProgram" open-type="navigate" app-id="wxe4f703cef420efe3" path="pagesE/zhufahuo/zhufahuo" :extra-data="extraData" version="develop">打开绑定的小程序</navigator> -->
					<view class="font-weight font-33 ml-2 zhufahuo" @click="zhufahuo()">
						<view class="zhufahuo-con">
							主发货
						</view>
					</view>
				</view>
				<view class="d-flex flex-wrap font mt-2 pr-1">
					<view class="common_content span-5  text-center py-2 my" v-for="(item,index) in common_list" :key="index" @click="goodsTo(item)" v-if="(item.id == 10 && is_view == 1) || item.id != 10">
						<view class="box">
							<image class="common_img" :src="item.img" mode="widthFix"></image>
						</view>
						<view class="asd mt-1 text-333 font-27">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:['is_merchant', 'is_view', 'openid', "ru_id"],
		data(){
			return {
				common_list:[
					{id:1,name:"添加商品",img:"../../static/images/home/add_goods_img.png"},
					{id:2,name:"在售商品",img:"../../static/images/home/sale_goods_img.png"},
					{id:3,name:"售罄商品",img:"../../static/images/home/sell_goods_img.png"},
					{id:4,name:"商品分类",img:"../../static/images/home/goods_class_img.png"},
					{id:5,name:"今日订单",img:"../../static/images/home/today_order_img.png"},
					{id:6,name:"待发货订单",img:"../../static/images/home/shipments_order_img.png"},
					{id:7,name:"待付款订单",img:"../../static/images/home/payment_order_img.png"},
					{id:8,name:"待收货订单",img:"../../static/images/home/delivery_order_img.png"},
					{id:9,name:"已完成订单",img:"../../static/images/home/fulfill_order_img.png"},
					{id:10,name:"客户管理",img:"../../static/images/home/shop_img.png"},
					{id:11,name:"用户中心",img:"../../static/images/home/user_img.png"},
					// {id:13,name:"客服中心",img:"../../static/images/home/user_img.png"},
					{id:12,name:"全部",img:"../../static/images/home/more_img.png"}
				],
			}
		},
		methods:{
			zhufahuo(){
				
				
				var openid = this.openid;
				if(!openid){
					var users = uni.getStorageSync("users");
					openid = users.open_id
				}
				
				var ru_id = this.ru_id;
				if(!ru_id){
					ru_id = uni.getStorageSync("user_id")
				}
				
				console.log("fdsafdsa",  'pagesE/fahuo/fahuo?ru_id=' + ru_id + '&openid=' + openid);
				
				
				uni.navigateToMiniProgram({
				  appId: 'wxe4f703cef420efe3',
				  path: 'pagesE/fahuo/fahuo', // 不填默认首页
				  envVersion: "trial",
				  extraData:{
					  ru_id:ru_id,
					  openid: openid
				  },
				  success(res) {
				    // 打开成功
				  }
				})
			},
			
			goodsTo(item){
				if(item.id==1){
					uni.navigateTo({
						url:"/pages/goods-add/goods-add"
					})
				}else if(item.id==2){
					uni.navigateTo({
						url:"/pages/goods-sale/goods-sale"
					})
				}else if(item.id==3){
					uni.navigateTo({
						url:"/pages/goods-sell/goods-sell"
					})
				}else if(item.id==4){
					if(this.is_merchant){
						uni.navigateTo({
							url:"/pages/goods-class/goods-class"
						})
					}else{
						uni.navigateTo({
							url:"/pages/goods-class-terrace/goods-class-terrace"
						})
					}
				}else if(item.id==5){
					uni.navigateTo({
						url:"/pagesA/order/order-today"
					})
				}else if(item.id==6){
					uni.navigateTo({
						url:'/pagesA/order/order-today-send'
					})
				}else if(item.id==7){
					uni.navigateTo({
						url:'/pagesA/order/order-payment'
					})
				}else if(item.id==8){
					uni.navigateTo({
						url:"/pagesA/order/order-take"
					})
				}else if(item.id==9){
					uni.navigateTo({
						url:"/pagesA/order/order-fulfilled"
					})
				}else if(item.id==10){
					uni.navigateTo({
						url:'/pagesB/client/shops'
					})
				}else if(item.id==11){
					uni.navigateTo({
						url:"/pagesA/user/user"
					})
				}else if(item.id==12){
					uni.navigateTo({
						url:"/pagesA/all-function/all-function"
					})
				}else if(item.id==13){
					uni.navigateTo({
						url:"/pagesA/kefu/list"
					})
				}
			}
		}
	}
</script>

<style>
	.changyong{
		line-height: 55rpx;
	}
	.zhufahuo{ border: 2rpx solid #E58883; padding: 3rpx;}
	.zhufahuo .zhufahuo-con{
		border: 1rpx solid #E0C0BD;
		font-size: 35rpx;
		line-height: 49rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
		color: #D71522;
	}
</style>
